import os
from pathlib import Path
from dotenv import load_dotenv

# 加载环境变量
load_dotenv()

# 项目根目录
ROOT_DIR = Path(__file__).parent.parent

# 日志配置
LOG_DIR = ROOT_DIR / "logs"
LOG_DIR.mkdir(exist_ok=True)

# FastMCP 服务器配置
DEFAULT_SSE_HOST = "http://127.0.0.1"
DEFAULT_SSE_PORT = 8100
DEFAULT_SSE_PATH = "/sse"

# 通义千问 API 配置
TONGYI_API_KEY = "sk-63d906c59541463ead75c86ca7b996af"
TONGYI_MODEL = "qwen-plus"  # 使用的模型名称

# API配置 - 使用兼容模式
TONGYI_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"

# SSE服务器配置
DEFAULT_SSE_HOST = "127.0.0.1"
DEFAULT_SSE_PORT = 8100

# Dify知识库配置
DIFY_API_BASE = "http://10.120.133.127:8001"
DIFY_DATASETS_ENDPOINT = "/v1/datasets"
DIFY_RETRIEVE_ENDPOINT = "/v1/datasets/{dataset_id}/retrieve"
DEFAULT_DATASET_ID = "5a4290f0-4a52-4ba1-b1bb-d81989546647"  # 默认知识库ID
DIFY_API_KEY = os.getenv("DIFY_API_KEY", "dataset-957NlCptUKKZbr47sG0La9a5")  # 从环境变量获取API密钥 